package com.api.tag.createtag;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.ITagApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.TagApiType;

@ContextConfiguration(locations = { "classpath:/tags/tags-context.xml" })
public class CreateTagNotAdministrator extends AbstractApiTest {

	@Value("#{tagtest['user.notAdministrator'].appId}")
	private String notAdminUrn;

	@Value("#{tagtest['user.notAdministrator'].password}")
	private String notAdminPassword;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(notAdminUrn, notAdminPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testCreateCategory() throws ZyncroApiException {

		String name = "Helooooooou";
		TagApiType tagType = TagApiType.CATEGORY;

		getApi().getService(ITagApiService.class).createTag(name, tagType);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testCreateLocation() throws ZyncroApiException {

		String name = "Helooooooou";
		TagApiType tagType = TagApiType.LOCATION;

		getApi().getService(ITagApiService.class).createTag(name, tagType);
	}
}
